package com.aaa.service.impl;

import com.aaa.dao.TermFinancialDao;
import com.aaa.pojo.TermFinancial;
import com.aaa.service.TermFinancialService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class TermFinancialServiceImpl implements TermFinancialService {
    @Autowired
    private TermFinancialDao termFinancialDao;
    @Override
    public List<TermFinancial> selectTerm() {
        return termFinancialDao.selectTerm();
    }

    @Override
    public PageInfo<TermFinancial> getPayByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//这行是重点，表示从pageNum页开始，每页pageSize条数据
        List<TermFinancial> list = termFinancialDao.selectTerm();
        PageInfo<TermFinancial> pageInfo = new PageInfo<TermFinancial>(list);
        return pageInfo;
    }

    @Override
    public Boolean addTermMoney(Integer u_id, Integer t_id, Double amount) {
        return termFinancialDao.addTermMoney(u_id,t_id,amount);
    }

    @Override
    public void addRecordMoney(Double t_amount, String t_name) {
        termFinancialDao.addRecordMoney(t_amount, t_name);
    }

    @Override
    public TermFinancial selectByTid(Integer tid) {
        return termFinancialDao.selectByTid(tid);
    }
}
